package elevatronic.view.left;

import elevatronic.view.ImageView;
import elevatronic.view.MPanel;
import elevatronic.view.left.elevators.ElevatorPanels;
import elevatronic.view.left.floors.FloorPanels;
import elevatronic.view.simulation.BuildingView;

public class LeftPanel extends MPanel{
	private static final long serialVersionUID = -5573577318372184533L;

	public static final int FLOORS_PANEL_POSX=131;
	public static final int FLOORS_PANEL_POSY=50;
	public static final int FLOORS_PANEL_WIDTH=52;
	public static final int FLOORS_PANEL_HEIGHT=500;
	public static final int ELEVATORS_PANEL_POSX=10;
	public static final int ELEVATORS_PANEL_POSY=5;
	public static final int ELEVATORS_PANEL_WIDTH=102;
	public static final int ELEVATORS_PANEL_HEIGHT=788;
	
	//the view of the buttons of each floor
	private FloorPanels floorsPanel;
	public FloorPanels getFloorsPanel() {
		return floorsPanel;
	}
	public void setFloorsPanel(FloorPanels floorsPanel) {
		this.floorsPanel = floorsPanel;
	}
	
	//the view of the buttons of each elevator
	private ElevatorPanels elevatorsPanel;
	public ElevatorPanels getElevatorsPanel() {
		return elevatorsPanel;
	}
	public void setElevatorsPanel(ElevatorPanels elevatorsPanel) {
		this.elevatorsPanel = elevatorsPanel;
	}

	

	
	
	/**
	 * Constructor
	 * @param wdth width of the panel
	 * @param hght height of the panel
	 */
	public LeftPanel(int wdth,int hght,BuildingView buildingView){
		super(wdth,hght);
	    setImagePanel(new ImageView("leftPanel",0,0,201,800));
	    setElevatorsPanel(new ElevatorPanels(ELEVATORS_PANEL_WIDTH,ELEVATORS_PANEL_HEIGHT,buildingView.getElevatorsView()));
	    getElevatorsPanel().setBounds(ELEVATORS_PANEL_POSX,ELEVATORS_PANEL_POSY,ELEVATORS_PANEL_WIDTH,ELEVATORS_PANEL_HEIGHT);
	    add(getElevatorsPanel());
	    
	    setFloorsPanel(new FloorPanels(FLOORS_PANEL_WIDTH,FLOORS_PANEL_HEIGHT,buildingView.getBuilding().getFloors()));
	    getFloorsPanel().setBounds(FLOORS_PANEL_POSX,FLOORS_PANEL_POSY,FLOORS_PANEL_WIDTH,FLOORS_PANEL_HEIGHT);
	    add(getFloorsPanel());
	}

	
	
	//iteration of the left panel
	public void update(int step){
		super.update(step);
		getElevatorsPanel().update(step);
		getFloorsPanel().update(step);
	}
	


}
